/*
day458 
2020.11.28 
*/
#include<iostream>
#include<vector>
using namespace std;

int main()
{
	return 0;
 } 
 
class Solution {
public:
    int binaryGap(int n) {
    	int sum=0,res=0;
		while(n && n%2==0)
		{
			n/=2;
		}
		
		while(n)
		{
			if(n%2==1)
			{
				res=max(res,sum);
				sum=0;
			}
			else
			{
				sum++;
			}
			n/=2;
		}
		return res;
    }
};
